package com.flyme.module.exam.provider.service.impl;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.flyme.common.core.model.ResultBody;
import com.flyme.common.core.utils.JsonUtils;
import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.exam.client.entity.ExaDuan;
import com.flyme.module.exam.client.entity.Exam;
import com.flyme.module.exam.client.entity.ExamOpt;
import com.flyme.module.exam.client.vo.ExamItem;
import com.flyme.module.exam.provider.mapper.ExaDuanMapper;
import com.flyme.module.exam.provider.mapper.ExamMapper;
import com.flyme.module.exam.provider.service.ExaDuanService;
import com.flyme.module.exam.provider.service.ExamOptService;
import com.flyme.module.exam.provider.service.ExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author: flyme
 * @date: 2018/3/7 15:27
 * @desc: 段位管理接口实现
 */
@Service
public class ExaDuanServiceImpl extends BaseServiceImpl<ExaDuanMapper, ExaDuan> implements ExaDuanService {

    /**
     * 查询最大等级
     */
    public ExaDuan findMax(){
        return list(q().orderByDesc("sortOrder")).get(0);
    }


    /**
     * 查询最小等级
     */
    public ExaDuan findMin(){
        return list(q().orderByAsc("sortOrder")).get(0);
    }

    /**
     * 根据排序查询段位
     */
    public ExaDuan findBySort(Integer sort){
        return getOne(q().eq(true, "sortOrder", sort) ,false);
    }
}
